<?php
class Index extends Action{
    public function __construct(){
        parent::__construct();
    }
    public function index(){
        $mod  =   M('users');
        //$mod->create();
        $data   =   I();
        /*
        $data['Name']="test2";
        $data['Pwd']="a123456";
        $data['Age']=20;
        $id =   $mod->add($data);
        $mod->where("id=1")->save(array('name'=>'user123'));
        $data   =   $mod->find();
        print_r($data);
        */
        $if    =   '{if $bool}
            bool是真<br/>
            {else}
            bool是假<br/>
            {/if}';
        $foreach    =   '{foreach key=key item=item from=$color}<br/>
		{@key}--{@item}<br/>
		{/foreach}';
        $include    =   '{include file="head.html"}';
        $var    =   '{$var}';
        $this->assign('if',$if);
        $this->assign('foreach',$foreach);
        $this->assign('include',$include);
        $this->assign('var',$var);
        $this->assign('bool',true);
        $this->assign('color',array('red','green','blue'));
        $this->display('/Index/index.html');
    }
    
    public function create(){
        $mod  =   M('users');
        $mod->create();
        $data['Name']="test2";
        $data['Pwd']="a123456";
        $data['Age']=20;
        $id =   $mod->add($data);
        echo $id;
    }
}
?>